Skip to main content

Get Ancestor

AutomatR.Web.GetAncestor

The "Get Ancestor" activity in AutomatR's Web Activities category retrieves ancestors for a specified UI element on a web page. This is useful when you need information about the parent elements of a particular web element during the automation process.

Properties

NameDescription
Input
Levels UpEnter an integer value specifying how many levels up you want to retrieve ancestor elements for the specified web element.
Web SelectorSelect the web element to indicate the element on the web using the selector window. Only one of "Web Selector" or "Web Element" should be provided.
Web ElementSelect the browse button to indicate the element on the web with the help of the selector window. Only one of "Web Selector" or "Web Element" should be provided.
Misc
Display NameProvides a customizable name for the activity displayed in the workflow. String variables containing the desired display name.
Optional
TimeoutEnter the time in seconds (e.g., 5 seconds) for the activity to be executed before throwing an exception. Default timeout is used if not specified.
DelayEnter the wait time in seconds (e.g., 5 seconds) before starting the activity. Useful for handling synchronization issues.
Output
ResultReturns a list of strings representing the ancestral elements of the specified web element. Variable of type List<Selector>.

How to use:

  1. Drag and drop the "Get Ancestor" activity onto the workflow.
  2. Choose either the "Web Selector" or "Web Element" property to indicate the web element for which you want to retrieve ancestors.
  3. Configure the "Levels Up" property to specify how many levels up you want to fetch ancestor elements.
  4. Optionally, configure the "Timeout" and "Delay" properties based on your requirements.
  5. Execute the workflow to retrieve the ancestor elements of the specified web element.

Example: Consider an example where the "Get Ancestor" activity is used to retrieve two levels up for a button on a web page:

Get Ancestor:
Web Selector: <your_selector_here>
Levels Up: 2
Timeout: 10
Delay: 2
Result: ancestorElements

In this example, the activity fetches the ancestor elements of the specified web element up to two levels. The result is stored in the variable "ancestorElements" for further use in the workflow.